#include "myc.h"

struct token operass = {"operass",7,NULL,NULL};
struct token operadd = {"operadd",7,NULL,NULL};
struct token opersub = {"opersub",7,NULL,NULL};
struct token opermul = {"opermul",7,NULL,NULL};
struct token operdiv = {"operdiv",7,NULL,NULL};
struct token opermod = {"opermod",7,NULL,NULL};
struct token opershr = {"opershr",7,NULL,NULL};
struct token opershl = {"opershl",7,NULL,NULL};
struct token operaad = {"operaad",7,NULL,NULL};
struct token operasu = {"operasu",7,NULL,NULL};
struct token operamu = {"operamu",7,NULL,NULL};
struct token operadi = {"operadi",7,NULL,NULL};
struct token operamo = {"operamo",7,NULL,NULL};
struct token operasr = {"operasr",7,NULL,NULL};
struct token operasl = {"operasl",7,NULL,NULL};
struct token operequ = {"operequ",7,NULL,NULL};
struct token operneq = {"operneq",7,NULL,NULL};
struct token opergre = {"opergre",7,NULL,NULL};
struct token operles = {"operles",7,NULL,NULL};
struct token operegr = {"operegr",7,NULL,NULL};
struct token operels = {"operels",7,NULL,NULL};
struct token operxor = {"operxor",7,NULL,NULL};
struct token operaxo = {"operaxo",7,NULL,NULL};
struct token operban = {"operban",7,NULL,NULL};
struct token operlan = {"operlan",7,NULL,NULL};
struct token operaan = {"operaan",7,NULL,NULL};
struct token operbor = {"operbor",7,NULL,NULL};
struct token operlor = {"operlor",7,NULL,NULL};
struct token operaor = {"operaor",7,NULL,NULL};
struct token opertri = {"opertri",7,NULL,NULL};
struct token operdot = {"operdot",7,NULL,NULL};
struct token operubn = {"operubn",7,NULL,NULL};
struct token operuln = {"operuln",7,NULL,NULL};
struct token operure = {"operure",7,NULL,NULL};
struct token operadr = {"operadr",7,NULL,NULL};
struct token operupo = {"operupo",7,NULL,NULL};
struct token operune = {"operune",7,NULL,NULL};
struct token operuin = {"operuin",7,NULL,NULL};
struct token operude = {"operude",7,NULL,NULL};
struct token opersin = {"opersin",7,NULL,NULL};
struct token opersde = {"opersde",7,NULL,NULL};

struct token *binoper(struct token *tok) {
	if (tokis(tok,"=")) return &operass;
	if (tokis(tok,"+ [")) return &operadd;
	if (tokis(tok,"-")) return &opersub;
	if (tokis(tok,"*")) return &opermul;
	if (tokis(tok,"/")) return &operdiv;
	if (tokis(tok,"%")) return &opermod;
	if (tokis(tok,">>")) return &opershr;
	if (tokis(tok,"<<")) return &opershl;
	if (tokis(tok,"+=")) return &operaad;
	if (tokis(tok,"-=")) return &operasu;
	if (tokis(tok,"*=")) return &operamu;
	if (tokis(tok,"/=")) return &operadi;
	if (tokis(tok,"%=")) return &operamo;
	if (tokis(tok,">>=")) return &operasr;
	if (tokis(tok,"<<=")) return &operasl;
	if (tokis(tok,"==")) return &operequ;
	if (tokis(tok,"!=")) return &operneq;
	if (tokis(tok,"<=")) return &operels;
	if (tokis(tok,">=")) return &operegr;
	if (tokis(tok,"<")) return &operles;
	if (tokis(tok,">")) return &opergre;
	if (tokis(tok,"^")) return &operxor;
	if (tokis(tok,"^=")) return &operaxo;
	if (tokis(tok,"&")) return &operban;
	if (tokis(tok,"&&")) return &operlan;
	if (tokis(tok,"&=")) return &operaan;
	if (tokis(tok,"|")) return &operbor;
	if (tokis(tok,"||")) return &operlor;
	if (tokis(tok,"|=")) return &operaor;
	if (tokis(tok,"?")) return &opertri;
	if (tokis(tok,".")) return &operdot;
	tokerror(tok,tok,"cannot find binray operator ");
	return NULL;
}

struct token *unaryoper(struct token *tok) {
	if (tokis(tok,"+")) return &operupo;
	if (tokis(tok,"-")) return &operune;
	if (tokis(tok,"!")) return &operuln;
	if (tokis(tok,"~")) return &operubn;
	if (tokis(tok,"*")) return &operure;
	if (tokis(tok,"&")) return &operadr;
	if (tokis(tok,"++")) return &operuin;
	if (tokis(tok,"--")) return &operude;
	tokerror(tok,tok,"cannot find unray operator ");
	return NULL;
}

struct token *sufoper(struct token *tok) {
	if (tokis(tok,"++")) return &opersin;
	if (tokis(tok,"--")) return &opersde;
	tokerror(tok,tok,"cannot find suffix operator ");
	return NULL;
}
